﻿using ZR.Admin.WebApi.Filters;
using ZR.Model.Souvenir.Dto;
using ZR.Service.Souvenir.IService;

namespace ZR.Admin.WebApi.Controllers.Souvenir
{
    [Verify]
    [Route("business/CustomerFeedback")]
    public class CustomerFeedbackController : BaseController
    {
        private readonly ICustomerFeedbackService _customerFeedbackService;
        
        public CustomerFeedbackController(ICustomerFeedbackService customerFeedbackService)
        {
            _customerFeedbackService = customerFeedbackService;
        }
        
        [HttpGet]
        [Route("getCustomerFeedbackWithPage")]
        public IActionResult GetCustomerFeedbackWithPage([FromQuery] CustomerFeedbackQueryDto parm)
        {
            return SUCCESS(_customerFeedbackService.SelectCustomerFeedbackWithPage(parm));
        }
        
        [HttpPost]
        [Route("addCustomerFeedback")]
        public IActionResult AddCustomerFeedback(CustomerFeedbackDto parm)
        {
            return SUCCESS(_customerFeedbackService.InsertCustomerFeedback(parm.ToCreate(HttpContext)));
        }
        
        [HttpPut]
        [Route("updateCustomerFeedback")]
        public IActionResult UpdateCustomerFeedback(CustomerFeedbackDto parm)
        {
            return SUCCESS(_customerFeedbackService.UpdateCustomerFeedback(parm));
        }
        
        [HttpDelete]
        [Route("deleteCustomerFeedback/{id}")]
        public IActionResult DeleteCustomerFeedback(long id)
        {
            return SUCCESS(_customerFeedbackService.DeleteCustomerFeedback(id));
        }
    }
}